/*
 * @Author: WuFeng <763467339@qq.com>
 * @Date: 2024-06-04 15:49:02
 * @LastEditTime: 2024-06-25 10:58:38
 * @LastEditors: WuFeng <763467339@qq.com>
 * @Description: vite 配置文件
 * @FilePath: \chu-meng\client\vite.config.js
 * @Copyright 版权声明
 */
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
import eslintPlugin from 'vite-plugin-eslint'
import vueSetupExtend from 'unplugin-vue-setup-extend-plus/vite'
import path from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  optimizeDeps: {
    exclude: [
      // // 排除@vue/runtime-dom模块的优化处理，从而消除onVnodeBeforeMountRef_警告 ， 需要注意的是，在生产环境中，vite会对优化进行处理，因此这个警告将不会出现
      // '@vue/runtime-dom'
    ]
  },
  resolve: {
    // 别名
    alias: {
      '@': path.resolve(__dirname, 'src'),
      '~@': path.resolve(__dirname, 'src')
    }
  },
  plugins: [
    vue(),
    Components({
      resolvers: [
        AntDesignVueResolver({
          importStyle: false, // css in js
        })
      ]
    }),
    // 添加 ESLint 插件配置
    eslintPlugin({
      include: ['src/**/*.js', 'src/**/*.vue', 'src/*.js', 'src/*.vue']
    }),
    vueSetupExtend({
      enableAutoExpose: true
    })
  ]
})
